

function goBackToMainScreen(event) {
	// Resets the list appearence after the user exits the event description
	for (var i = 0; i < 10; i++) {
		var JQUERYeventId = "#eventList_event" + i;
		$(JQUERYeventId).css({ 
			"display": "block", 
			"font-weight": "normal", 
			"font-size": "12px", 
			"visibility": "visible", 
			"padding": "10px" 
		});
	}
	
	// Bring back main screen toolbars
	$('.viewtogglebar_container').css({ "display": "block"});
	$('.timescalingbar_container').css({ "display": "block"});
	$('.eventRangeBar_object').css({ "display": "block"});

	// Bring back the sorting buttons
	$('.eventList_sortButton').css({ "display": "block"});

	// Hide event description toolbars
	$('.eventDescription_toolbars').css({ "display": "none"});

	// Hide the liking buttons
	$('.eventDescription_preferenceObjects').css({ "display": "none"});
}




function showEventDescription(index, eventName) {

	// Only show the event that you want to show

	$(".mapcontainer").css({ "width": "0%", "height": "0%", "visibility": "hidden" });
	$(".eventlist").css({ "width": "100%", "height": "100%", "visibility": "visible" });	
	$("#list").css({ "width": "100%"});
	$("#list").css({ "width": "100%"});

	var JQUERYeventId = "#eventList_event" + index;
	$(JQUERYeventId).css({ "font-weight": "bold", "font-size": "15px",});

	for (var i = 0; i < 10; i++) {
		var JQUERYeventId = "#eventList_event" + i;
		if (i != index) {
			$(JQUERYeventId).css({ "display": "none", "visibility": "hidden", "padding": "0px"});
		}
	}

	// Hide the top two toolbars

	$('.viewtogglebar_container').css({ "display": "none"});
	$('.timescalingbar_container').css({ "display": "none"});

	// Hide the sorting buttons
	$('.eventList_sortButton').css({ "display": "none"});

	// Hide the lower navbar button
	$('.eventRangeBar_object').css({ "display": "none"});
	

	// Reveal the new toolbars

	$('.eventDescription_nametoolbar').css({ "display": "block"});
	var eventName = String( document.getElementById("eventList_event" + index).innerHTML ).substring(4);
	eventName = eventName.substring(0, eventName.indexOf("<br>"));
	document.getElementById("eventnamelabel").innerHTML = eventName;
	$('.eventDescription_toolbars').css({ "display": "block"});

	// Show the liking buttons
	$('.eventDescription_preferenceObjects').css({ "display": "block"});

}





function acceptPositiveFeedback(event) { 
	recordFeedback(1);
}

function acceptNegativeFeedback(event) {
recordFeedback(0);
}

function recordFeedback(isFeedbackPositive) {
	if (isFeedbackPositive == 1) {
		alert("Positive event feedback received!");
	}
	if (isFeedbackPositive == 0) {
		alert("Negative event feedback received!");
	}
}

function goToDirectionsScreen(event) { 
var startLat = currentLat;
var startLon = currentLon;

var endLat = selectedEventLat;
var endLon = selectedEventLon;

var directionsUrl = "http://maps.google.com/maps?f=d&source=s_d&saddr=" + startLat + ",+" + startLon
			+ "&daddr=" + endLat + ",+" + endLon + "&dirflg=w";
//alert(directionsUrl);


window.open(directionsUrl, 'toolbar=yes');
}





function sortbydistance(event) { 
alert("Sorting events by shortest distance away");
}

function sortbytime(event) { 
alert("Sorting events by soonest start time");
}
